import React, { Component } from 'react';
import ReactDOM from 'react-dom';

class Control extends Component {
    state = {
        username: 'saber',
        password: 123456
    }
    handleChange = (e) => {
        console.log(e.target)
        this.setState({ [e.target.name]: e.target.value });
    }
    render() {
        return (<div>
            <input type='text' value={this.state.username} onChange={this.handleChange} name='username' />
            {this.state.username}
            <input type='text' value={this.state.password} onChange={this.handleChange} name='password' />
            {this.state.password}
        </div>);
    }
}

ReactDOM.render(<Control></Control>, window.root)

export default Control;